function zoomOut(obj)
%zoom out by 110% display widget

% This file is part of CISNE.
%
%     CISNE is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     any later version.
%
%     CISNE is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%     GNU General Public License for more details.
%
%     You should have received a copy of the GNU General Public License
%     along with CISNE.  If not, see <http://www.gnu.org/licenses/>.

% Copyright 2011. Jose Maria Garcia-Valdecasas Bernal

%get actual limits and selected center point.
xlim=get(obj.m_inputAx,'XLim');
ylim=get(obj.m_inputAx,'YLim');
p=obj.currentPoint();

%obtain length in each axis (after zooming)
dx=(xlim(2)-xlim(1))*1.2;
dy=(ylim(2)-ylim(1))*1.2;

%check if we are out bounds and re-center zoom
Lims=obj.getAxesLimits;
Dx=Lims(2)-Lims(1);

if dx>Dx %we are trying to zoom out more than painted
    xmin=Lims(1);
    xmax=Lims(2);
    ymin=Lims(3);
    ymax=Lims(4);
else
    if p(1)-dx/2<Lims(1) %if x-dx/2<xmin
        xmin=Lims(1);
        xmax=Lims(1)+dx;
    elseif p(1)+dx/2>Lims(2) %x+dx/2>xmax
        xmax=Lims(2);
        xmin=Lims(2)-dx;
    else
        xmin=p(1)-dx/2;
        xmax=p(1)+dx/2;
    end
    
    if p(2)-dy/2<Lims(3) %if y-dy/2<ymin
        ymin=Lims(3);
        ymax=Lims(3)+dy;
    elseif p(2)+dy/2>Lims(4) %y+dy/2>ymax
        ymax=Lims(4);
        ymin=Lims(4)-dy;
    else
        ymin=p(2)-dy/2;
        ymax=p(2)+dy/2;
    end
end
set(obj.m_inputAx,'XLim',[xmin xmax],'YLim',[ymin ymax]);
set(obj.m_compAx,'XLim',[xmin xmax],'YLim',[ymin ymax]);
obj.setAction('');
end